<?php
namespace app\admin\model;
use \think\Model;
use think\Db;


class User extends Model {

    protected $pk = 'id';
    protected $table = 'sdb_user';


    public function getBeanUserBank($id)
    {
        return  db('user_bank')->where('bind_staff',0)->where('user_id',$id)->find(1);
    }

    /**
     * 用户关联多条银行账户信息
     * @return \think\model\relation\HasMany
     */
    public function bankAccount()
    {
        return $this->hasMany('UserBank');
    }

    /**
     * 用户关联订单模型
     * @return \think\model\relation\HasMany
     */
    public function orders()
    {
        return $this->hasMany('Order','user_id','id');
    }
    public function orderBeanAccount()
    {
        return $this->hasMany('OrderBeans','user_id','id');
    }
}